package cn.growthgate.fgo.entity;

import com.baomidou.mybatisplus.enums.FieldStrategy;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

/**
 * <p>
 * 我的素材
 * </p>
 *
 * @author GrowthGate
 * @since 2019-06-25
 */
@TableName("t_my_item")
public class MyItem extends Model<MyItem> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 用户id
     */
    private Long userId;

    /**
     * 道具id
     */
    @NotNull(message = "道具id不能为空")
    private Long itemId;

    /**
     * 数量
     */
    @Min(value = 0, message = "持有数不能小于0")
    @TableField(strategy = FieldStrategy.IGNORED)
    private Integer number;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }
    public Long getItemId() {
        return itemId;
    }

    public void setItemId(Long itemId) {
        this.itemId = itemId;
    }
    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "MyItem{" +
        "id=" + id +
        ", userId=" + userId +
        ", itemId=" + itemId +
        ", number=" + number +
        "}";
    }
}
